<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>
        let promise = new Promise(function (resolve, reject) {
            console.log("promise do some code.....")
            resolve("promise success")
        })

        // 等待 promise 对象状态发生变化时才会执行的代码
        promise.then(
            function (value) {
                // promise 转换为 resolved 状态时 会执行的函数
                console.log('promise success' + value)
            }
        ).catch(
            function (value) {
                // promise 转换为 reject 会执行的函数
                console.log("promise fail" + value)
            }
        )
        console.log('other code1')
        console.log("other code 2")
    </script>
</head>

<body>

</body>

</html>